import * as api from '@/api/dataDic'  // 库存监管数据字典相关接口
const dataDic = {
	state: {
		parkingType: [],   // 停车场类型
		audtiStatus: [],   // 审核状态
		inoutBoundStatus: [],   // 出入库单状态
		businessType: [],   // 业务类型
		supervisingPlan: []  // 监管方案
	},
	mutations: {
		SET_PARKING_TYPE: (state, parkingType) => {
			state.parkingType = parkingType
		},
		SET_AUDTI_STATUS: (state, audtiStatus) => {
			state.audtiStatus = audtiStatus
		},
		SET_INOUTBOUND_STATUS: (state, inoutBoundStatus) => {
			state.inoutBoundStatus = inoutBoundStatus
		},
		SET_BUSINESS_TYPE: (state, businessType) => {
			state.businessType = businessType
		},
		SET_SUPERVISING_PLAN: (state, supervisingPlan) => {
			state.supervisingPlan = supervisingPlan
		}
	},
	actions: {
		GetParkingType({ commit, state }) {
			return new Promise((resolve, reject) => {
				api.parkingType().then(res => {
					const data = res.data
					commit('SET_PARKING_TYPE', data)
					resolve(res)
				}).catch(err => {
					reject(err)
				})
			})
		},
		GetAudtiStatus({ commit, state }) {
			return new Promise((resolve, reject) => {
				api.audtiStatus().then(res => {
					const data = res.data
					commit('SET_AUDTI_STATUS', data)
					resolve(res)
				}).catch(err => {
					reject(err)
				})
			})
		},
		GetInoutboundStatus({ commit, state }) {
			return new Promise((resolve, reject) => {
				api.inoutboundStatus().then(res => {
					const data = res.data
					commit('SET_INOUTBOUND_STATUS', data)
					resolve(res)
				}).catch(err => {
					reject(err)
				})
			})
		},
		GetBusinessType({ commit, state }) {
			return new Promise((resolve, reject) => {
				api.businessType().then(res => {
					const data = res.data
					commit('SET_BUSINESS_TYPE', data)
					resolve(res)
				}).catch(err => {
					reject(err)
				})
			})
		},
		GetSupervisingPlan({ commit, state }) {
			return new Promise((resolve, reject) => {
				api.supervisePlan().then(res => {
					const data = res.data
					commit('SET_SUPERVISING_PLAN', data)
					resolve(res)
				}).catch(err => {
					reject(err)
				})
			})
		}

	}
}
export default dataDic